<?php

class NewsController extends Controller {

    public $layout = "column2";

    public function actionIndex() {
        $this->render('index');
    }
    
    /**
     * 资讯列表
     */
    public function actionList(){
        $master = Yii::app()->request->getQuery('master');
        $model = SubsiteCategory::model()->getPage($master);
        $newsModel = new Information;
        $newsModel->unsetAttributes();
        $newsModel->info_sort = $model->infosort_id;
        $newsModel->info_state = 1;
        
        $this->render('index', array(
            'model' => $model,
            'news' => $newsModel->search()
        ));
    }

    /**
     * 单面内容
     */
    public function actionPage() {
        $master = Yii::app()->request->getQuery('master');
        $model = SubsiteCategory::model()->getPage($master);
        $this->render('page', array('model' => $model));
    }

    public function actionView() {
        $master = Yii::app()->request->getQuery('master');//分类
        $categoryModel = SubsiteCategory::model()->getPage($master);
        $alias = Yii::app()->request->getQuery('alias');//新闻
        $newsInfo = Information::model()->getInfoByAlias($alias);
        $this->render('view', array(
            'category' => $categoryModel,
            'news' => $newsInfo,
        ));
    }

}